home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wsc4d21.zip / WSC4D_U.TXT < prev    next >
Text File  |  1997-06-09  |  45KB  |  1,202 lines

  1.  
  2.  
  3.  
  4.                      Windows Standard Communications
  5.  
  6.                             Library for Delphi
  7.  
  8.                                  (WSC4D)
  9.  
  10.  
  11.                               USERS MANUAL
  12.  
  13.  
  14.  
  15.                                Version 2.1
  16.  
  17.                                June 9, 1997
  18.  
  19.  
  20.  
  21.  
  22.                      This software is provided as-is.
  23.               There are no warranties, expressed or implied.
  24.  
  25.  
  26.  
  27.  
  28.                          Copyright (C) 1996-1997
  29.                            All rights reserved
  30.  
  31.  
  32.  
  33.                         MarshallSoft Computing, Inc.
  34.                            Post Office Box 4543
  35.                            Huntsville AL 35815
  36.  
  37.                            Voice : 205-881-4630
  38.                              FAX : 205|880|0925
  39.                              BBS : 205-880-9748
  40.                            email : info@marshallsoft.com
  41.                              web : www.marshallsoft.com
  42.  
  43.                                _______
  44.                           ____|__     |                (R)
  45.                        --+       |    +-------------------
  46.                          |   ____|__  |  Association of
  47.                          |  |       |_|  Shareware
  48.                          |__|   o   |    Professionals
  49.                        --+--+   |   +---------------------
  50.                             |___|___|    MEMBER
  51.  
  52.  
  53.       MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.      WSC4D Users Manual                                        Page 1
  61.  
  62.                             C O N T E N T S
  63.  
  64.  
  65.  
  66.  
  67.  
  68.       Chapter                                                   Page
  69.  
  70.        1.0 Introduction................................................3
  71.            1.1 User Support............................................4
  72.            1.2 ASP Ombudsman...........................................4
  73.            1.3 Determining UART Address & IRQ Settings.................5
  74.            1.4 Installation............................................6
  75.        2.0 Library Overview............................................7
  76.            2.1 Dynamic Link Libraries..................................7
  77.            2.2 Using the Library.......................................7
  78.            2.3 Compiling Programs......................................7
  79.            2.4 Source Code.............................................7
  80.        3.0 Talking to Your Modem.......................................8
  81.            3.1 Modem Standards.........................................8
  82.            3.2 Flow Control...........................................10
  83.            3.3 Modem Initialization...................................10
  84.        4.0 Modem I/O..................................................11
  85.            4.1 MIO Introduction.......................................11
  86.            4.2 MIO Function Summary...................................11
  87.        5.0 XMODEM & YMODEM ...........................................12
  88.            5.1 XYDRIVER Introduction..................................12
  89.            5.2 XYDRIVER Function Summary..............................12
  90.        6.0 Problems...................................................13
  91.        7.0 Serial Communications......................................14
  92.            7.1 Communications Basics..................................14
  93.            7.2 RS232 Signals..........................................15
  94.        8.0 Example Programs...........................................16
  95.            8.1 SIMPLE.................................................16
  96.            8.2 SELFTEST...............................................16
  97.            8.3 MODEM..................................................16
  98.            8.4 TERM...................................................16
  99.            8.5 FIND...................................................16
  100.       9.0 Legal Issues................................................19
  101.           9.1 Registration............................................18
  102.           9.2 License.................................................18
  103.           9.3 Warranty................................................18
  104.       10.0 Summary....................................................19
  105.           10.1 Revision History.......................................19
  106.           10.2 WSC Function Summary...................................19
  107.           10.3 Further Reading........................................20
  108.       11.0 Other MarshallSoft Computing Products......................20
  109.           11.1 Personal Communications Library for Windows............20
  110.           11.2 Personal Communications Library for C/C++..............20
  111.           11.3 Libraries for Other Languages..........................20
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.      WSC4D Users Manual                                        Page 2
  121.  
  122.       1.0 Introduction
  123.  
  124.       The Windows Standard Communications Library for Delphi (WSC4D) is an
  125.       asynchronous communications dynamic link library (DLL) which uses the
  126.       standard Windows serial communications API. Since it uses the Windows
  127.       API, programs using the WSC library are fully compatible with other
  128.       Window applications which also use the Windows serial communications
  129.       API. Both Win16 and Win32 versions are included.
  130.  
  131.       Using WSC is very straight-forward. For example, to write 'HELLO' to
  132.       the serial port COM1:
  133.  
  134.            Code := SioReset(COM1,512,512);    (* open COM1 *)
  135.            Code := SioPuts(COM1,'HELLO',5);   (* write 'HELLO' to COM1 *)
  136.            Code := SioDone(COM1);             (* close COM1 *)
  137.  
  138.       Five Delphi example programs with full source code are included.
  139.       Refer to chapter 8 for more details on each of the example programs.
  140.  
  141.              SIMPLE : A simple terminal emulator.
  142.  
  143.            SELFTEST : Performs COM port functionality testing.
  144.  
  145.               MODEM : Same as SIMPLE but controls flow control, modem
  146.                       lines, etc.
  147.  
  148.                TERM : Terminal emulator with XMODEM & YMODEM.
  149.  
  150.                FIND : Finds connected modem.
  151.  
  152.       WSC4D contains over 30 functions. All functions return a negative
  153.       number if an error condition is detected.  For more details, consult
  154.       the WSC4D Reference Manual
  155.  
  156.       WSC4D uses the same function names and arguments as PCL4W (our
  157.       Windows Communications Library that does NOT use the Windows API)
  158.       except for a few functions.
  159.  
  160.       Our goal is to provide a robust serial communications library that
  161.       that you and your customers can depend upon. Contact us if you have
  162.       any questions.
  163.  
  164.       The shareware and registered versions are identical except for two
  165.       differences: (1) the shareware version displays the 'shareware'
  166.       screen, and (2) the shareware version will 'time out' after 20
  167.       minutes, limiting execution to a maximum of twenty minutes each time
  168.       a program is run. Of course, the registered version does not display
  169.       the shareware screen nor time out after twenty minutes.
  170.  
  171.       We apologize for the inconvenience of the shareware screen and
  172.       time-outs, but it is necessary to encourage registration by some who
  173.       would use the library (sometimes for years) without registering.
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.      WSC4D Users Manual                                        Page 3
  181.  
  182.       1.1 User Support
  183.  
  184.       We want you to be successful in developing your applications using
  185.       WSC4D! We depend upon our customers to let us know what they need in
  186.       a communications library.  This means we are committed to providing
  187.       the best communications library that we can. If you have any
  188.       suggestions or comments, please let us know.
  189.  
  190.       If you are having a problem using WSC4D, call us at 205-881-4630
  191.       between 1:30 PM and 9:30 PM CST Monday through Friday. You can also
  192.       call at other times and leave a message, and call back later for a
  193.       reply.
  194.  
  195.       However, we can only answer questions with respect to using the WSC4D
  196.       library.  We cannot help you program your application.
  197.  
  198.       If you are on the Internet, email us at info@marshallsoft.com.  You
  199.       can also get the latest versions of our products from our anonymous
  200.       ftp site:
  201.  
  202.             FTP: ftp.marshallsoft.com      PATH: marshallsoft
  203.  
  204.       You may also call our User Support BBS (2400 to 14400 baud, no
  205.       parity, 8 data bits, 1 stop bit) at 205-880-9748 and leave a message
  206.       (address it to the SYSOP).  We will reply within 24 hours.
  207.  
  208.       The BBS is available 24 hours per day except at 2 PM Sundays for
  209.       maintenance. All files are in standard ZIP format. The BBS will
  210.       contain the latest shareware version of all MarshallSoft products as
  211.       well as related files such as:
  212.  
  213.            BUGS.ZIP:  Bug report.
  214.            NEWS.ZIP:  Latest news regarding our products.
  215.  
  216.       The MarshallSoft Computing, Inc. newsletter 'Comm Talk' is published
  217.       quarterly.  It discusses various communications problems and
  218.       solutions using WSC4D as well as related information.
  219.  
  220.       The latest copy of our newsletter can be found on our User Support
  221.       BBS (in file area 'Newsletters'), our anonymous ftp site (directory
  222.       /marshallsoft) as well as our web site.
  223.  
  224.           Web site:  www.marshallsoft.com
  225.  
  226.       1.2 ASP Ombudsman
  227.  
  228.       MarshallSoft Computing, Inc.  is a member of the Association of
  229.       Shareware Professionals (ASP).  ASP wants to make sure that the
  230.       shareware principle works for you.  If you are unable to resolve a
  231.       shareware-related problem with an ASP member by contacting the member
  232.       directly, ASP may be able to help.  The ASP Ombudsman can help you
  233.       resolve a dispute or problem with an ASP member, but does not provide
  234.       technical support for members' products. Please write to the ASP
  235.       Ombudsman at 545 Grover Road, Muskegon, MI USA 49442-9427, Fax
  236.       616-788-2765, or send a CompuServe message via CompuServe Mail to ASP
  237.       Ombudsman 70007,3536.
  238.  
  239.  
  240.      WSC4D Users Manual                                        Page 4
  241.  
  242.       1.3 Determining UART Address & IRQ Settings
  243.  
  244.       You will not normally need to know the port addresses or IRQ
  245.       assignments made by Windows. But this information is maintained by
  246.       Windows and is available if you need it.
  247.  
  248.       Both Windows 3.X and Windows 95 maintain a list of serial port
  249.       settings.  On Windows 3.X systems, choose the 'Ports' icon in the
  250.       'Control Panel' in the 'Main Group'.  Select 'Settings' and then
  251.       'Advanced' to view the COM port UART address and IRQ settings.
  252.  
  253.       In Windows 95, choose 'My Computer' icon ('or whatever your computer
  254.       icon is named), select the 'Control Panel' folder and then the
  255.       'System' icon.  Click on the 'Device Manager' tab.  Click 'Computer'
  256.       and then click 'Properties'. Click the 'View Resources' tab.  To view
  257.       reserved resources, click the resource type at the top of the dialog
  258.       box (i.e., 'Interrupt request (IRQ)' or 'Input/output (I/O)' ).
  259.  
  260.       The four standard COM ports which Windows typically controls are:
  261.  
  262.             Port  Address  IRQ
  263.             COM1   0x3F8    4
  264.             COM2   0x2F8    3
  265.             COM3   0x3E8    4
  266.             COM4   0x2E8    3
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.      WSC4D Users Manual                                        Page 5
  301.  
  302.       1.4 Installation
  303.  
  304.       (1) Before installation of WSC4D, your Delphi compiler should already
  305.       be installed on your system and tested. Note that Delphi 2 or Delphi
  306.       3 is required in order to create Win32 programs.
  307.  
  308.       Examine the file 'FILES.LST' for a list of the distribution files.
  309.  
  310.       (2) Make a backup copy of your distribution disk.  Put your original
  311.       distribution disk in a safe place.
  312.  
  313.       (3) Exit Windows into DOS, or start a DOS window:
  314.  
  315.       (4) Create your WSC project directory, copy the WSC archive, then
  316.       unzip the archive. For example:
  317.  
  318.                 MKDIR   WSC
  319.                 PKUNZIP WSC4D21.ZIP WSC
  320.  
  321.       (5) Run the install program INSTALL.BAT which will copy the correct
  322.       files for your installation (Delphi 1.0) or Delphi 2.0).
  323.  
  324.       If you are using Delphi 1 (Win16), then type:
  325.  
  326.                 INSTALL 16
  327.  
  328.       If you are using Delphi 2 or Delphi 3, (Win32), then type:
  329.  
  330.                 INSTALL 32
  331.  
  332.       The install program creates WSC.PAS from either WSC16.PAS or
  333.       WSC32.PAS, and copies the proper DLLs. This way, the source code for
  334.       the example programs is identical for both 16-bit Delphi and 32-bit
  335.       Delphi.
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.      WSC4D Users Manual                                        Page 6
  361.  
  362.       2.0 Library Overview
  363.  
  364.       2.1 Dynamic Link Libraries
  365.  
  366.       WSC4D includes both Win16 [WSC16] and a Win32 [WSC32] dynamic link
  367.       library (DLL). A DLL is characterized by the fact that it need not be
  368.       loaded until required by an application program and that only one
  369.       copy of the DLL is necessary regardless of the number of application
  370.       programs that use it. Contrast this to the traditional static library
  371.       which is bound to each and every application that uses it at link
  372.       time.
  373.  
  374.       Since WSC4D is a DLL, only one copy of the WSC4D code and data is
  375.       loaded into memory regardless of the number of applications programs
  376.       that use it. For example, more than one instance of the test program
  377.       SIMPLE can be started.  All copies of SIMPLE can run concurrently as
  378.       long as each uses a different COM port.
  379.  
  380.       2.2 Using the Library
  381.  
  382.       The WSC4D has been tested on a Gateway 2000 25 MHz 80386-DX, a
  383.       Gateway 2000 66 MHz 80486-DX2 (Windows 3.1), a Mid-West Micro 150 MHz
  384.       Pentium (Windows 95), and a Toshiba Satellite 100 MHz Pentium
  385.       (Windows 95).
  386.  
  387.       WSC4D has also been tested with Borland Delphi 1.0 and Delphi 2.0.
  388.  
  389.       Please examine the WSC.PAS file. Note that COM1 is defined as port
  390.       zero, not port one.  The user must assume the responsibility for
  391.       passing the correct information when calling WSC4D functions.
  392.  
  393.       We recommend that you experiment with the example programs.
  394.  
  395.       2.3 Compiling Programs
  396.  
  397.       Each of the example program should be compiled and run. In Delphi,
  398.       its easy!
  399.  
  400.       Before beginning, be sure to run INSTALL that will copy the proper
  401.       Win16 (or Win32) files.
  402.  
  403.       2.4 Source Code
  404.  
  405.       The source code for WSC.DLL, MIO.DLL, and XYDRIVER.DLL is written in
  406.       standard ANSI C, and is included on the registered disk.
  407.  
  408.       To compile these programs from source, the Borland C/C++ Windows
  409.       compiler is required.
  410.  
  411.       All source code for the example programs is included in both the
  412.       shareware and registered archive. All example programs compile under
  413.       both Delphi 1 (Win16) and Delphi 2 (Win32).
  414.  
  415.       The same set of DLLs is used for all WSC products: C/C++ (WSC4C),
  416.       Delphi (WSC4D) and Visual Basic (WSC4VB).
  417.  
  418.  
  419.  
  420.      WSC4D Users Manual                                        Page 7
  421.  
  422.       3.0 Talking to Your Modem
  423.  
  424.       A modem is used to extend the distance over which you may
  425.       communicate. Without a modem, your RS232 cable is limited to a
  426.       maximum of approximately 50 feet.  But with a modem, you can
  427.       communicate literally around the world.
  428.  
  429.       3.1 Modem Standards
  430.  
  431.       Two modems can communicate over a telephone line only if they are
  432.       both using the same signaling frequencies and modulation, which are
  433.       determined by the modem standards used.  Modem standards can be
  434.       divided into three sets: (1) speed, (2) data compression used, and
  435.       (3) error control.
  436.  
  437.       The Bell standards (103 & 212A) are those of AT&T.  The CCITT (The
  438.       International Consultative Committee for Telephone and Telegraph)
  439.       standards are designated as 'V. '.
  440.  
  441.       Speed
  442.  
  443.            Bell 103  :   300 baud
  444.            Bell 212A :  1200 baud
  445.            V.21      :   300 baud
  446.            V.22bis   :  1200 & 2400 baud
  447.            V.32      :  4800 & 9600 baud
  448.            V.32bis   :  4800, 7200, 9600, 12000, and 14400 baud
  449.            V.34      :  to 28800 baud.
  450.  
  451.       Data Compression
  452.  
  453.            MNP 5     :  Microcom Networking Protocol (proprietary).
  454.            V.42bis   :  International data compression standard.
  455.  
  456.       Error Control
  457.  
  458.            MNP 2,3,4 :  Three level error correction (public domain).
  459.            V.42      :  International error correction standard.
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.      WSC4D Users Manual                                        Page 8
  481.  
  482.       3.2 Flow Control
  483.  
  484.       With modems using data compression, the modem to modem connection
  485.       will run at various speeds depending on the quality of the line. The
  486.       computer to modem connection will be at a fixed baud rate. Therefore,
  487.       a protocol (flow control) is necessary to synchronize the data flow
  488.       between a modem and the computer to which it is connected. Refer to
  489.       your modem manual for information on flow control protocols
  490.       supported.
  491.  
  492.       Two flow control protocols are used by most all modems which require
  493.       flow control.  Software flow control is called 'XON/XOFF' (other
  494.       software flow control character pairs are defined but operate the
  495.       same as XON/XOFF) and hardware flow control is called 'RTS/CTS'. Most
  496.       modems which require flow control enable hardware flow control by
  497.       default.
  498.  
  499.       In XON/XOFF (software) flow control, the computer suspends
  500.       transmitting data if it receives a XOFF character (13 hex) from the
  501.       modem, and continues transmitting when it receives a XON character
  502.       (11 hex).  Similarly, the computer can signal the modem not to send
  503.       any more data by transmitting a XOFF to it, and can tell the modem to
  504.       continue transmission be sending a XON.
  505.  
  506.       In RTS/CTS (hardware) flow control, the RTS line is used by the
  507.       computer to signal the modem , while the CTS line is used by the
  508.       modem to signal the computer.  The RTS line is set OFF by the
  509.       computer to tell the modem to suspend transmission, and set to ON to
  510.       tell the modem to continue transmission.  The CTS line is set to OFF
  511.       by the modem to tell the computer to stop transmitting, and set to ON
  512.       to tell the computer to continue transmitting.
  513.  
  514.       Given the choice, always choose hardware flow control over software
  515.       flow control so that all data transmission is transparent.  If
  516.       hardware flow control is not the default (which it almost always is),
  517.       you should modify your modem initialization string to turn hardware
  518.       flow control on.
  519.  
  520.       WSC4D supports both hardware and software flow control.  Refer to the
  521.       SioFlow function in the WSC4D Reference Manual.
  522.  
  523.       NOTE: When hardware flow control is enabled (by calling SioFlow), no
  524.       serial I/O can occur until both DSR and CTS are set by the modem.
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.      WSC4D Users Manual                                        Page 9
  541.  
  542.       3.3 Modem Initialization
  543.  
  544.       If your application uses a modem (as opposed to using a null modem
  545.       cable), then you should always send an initialization string to your
  546.       modem. Communication programs such as PROCOMM and TELIX always send
  547.       such a string automatically as soon as they start up.
  548.  
  549.       The particular initialization string depends on the make of your
  550.       modem.  For most modems, the following string (followed by a carriage
  551.       return) should work:
  552.  
  553.            AT E1 S7=60 S11=60 V1 X1 Q0 S0=0
  554.  
  555.       Refer to your Modem User's Guide for a full discussion of these
  556.       commands.  A brief description is as follows:
  557.  
  558.            AT     Modem attention command.
  559.            E1     Modem will echo what you send to it.
  560.            S7=60  Wait 60 seconds for carrier and/or dial tone.
  561.            S11=60 Use 60 milliseconds for tone dialing duration & spacing.
  562.            V1     Display result code as words (not numbers).
  563.            X1     Use the extended result message (CONNECT XXXX) set.
  564.            Q0     Modem displays result codes.
  565.            S0=0   Do not answer RING.
  566.  
  567.       If your application will answer incoming calls, then set the S0
  568.       register to the ring on which to automatically answer.
  569.  
  570.       If you send the above codes by using SioPutc (as opposed to typing
  571.       them from the keyboard), then follow these guidelines:
  572.  
  573.       (1) Send an initial carriage return before the initialization string.
  574.  
  575.       (2) Pause at least 150 milliseconds after each character sent as
  576.       your modem needs the time to perform its own internal processing.
  577.       Pause a little longer if your modem is not accepting your
  578.       initialization string.
  579.  
  580.       (3) Pause one and a half seconds after sending any initialization
  581.       command such as ATZ or AT&F since your modem must do quite a bit of
  582.       processing.
  583.  
  584.       If you experience any problems in initializing your modem, you should
  585.       first reset it to factory settings by sending:
  586.  
  587.            AT&F
  588.  
  589.       NOTE: Use AT&F1 for US Robotics modems.
  590.  
  591.       Refer to the TERM program (function SendToModem is in the file MIO.C)
  592.       for an example of sending an initialization string to a modem.
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.      WSC4D Users Manual                                        Page 10
  601.  
  602.       4.0 MODEM I/O (MIO)
  603.  
  604.       4.1 MIO Introduction
  605.  
  606.       The file MIO.PAS contains prototypes for using the Modem I/O DLL.
  607.       These functions ease communicating with modems using AT commands. The
  608.       TERM example has an example of using the MIO functions.
  609.  
  610.       The Windows 'operating system' is what is called 'cooperative
  611.       multitasking' (except Win32). The executing Windows task must
  612.       voluntarily 'give up' control before another Windows task (or Windows
  613.       itself) can execute. The MIO functions are broken down into parts
  614.       called states, and control is returned to Windows between executing
  615.       each state.
  616.  
  617.       For example:
  618.  
  619.       (1) Send the string to the MIO driver by executing:
  620.  
  621.       Code := mioSendTo(Port,100,'!ATDT1,205,880,9748');
  622.  
  623.       The '!' characters are converted to carriage returns.  The text
  624.       string is copied into the driver's data area.
  625.  
  626.       (2) Call mioDriver (typically based on a timer) until MIO_IDLE is
  627.       returned. Each time mioDriver is called, it will send another
  628.       character to the modem provided the required delay (since the
  629.       previous character was sent) has passed.  If the delay has not
  630.       passed, the driver simply returns MIO_RUNNING, but without actually
  631.       sending a character to the modem.  Once all characters have been
  632.       sent, mioDriver will return MIO_IDLE, indicating it is done and is
  633.       ready to accept another function.
  634.  
  635.       mioDriver will return MIO_RUNNING if it is still processing. Anything
  636.       else indicates that it is still processing and the returned value is
  637.       a character from the modem that can be displayed if wanted.
  638.  
  639.       (3) Once mioDriver returns MIO_IDLE, call mioResult to get the result
  640.       of the mioSendTo call.
  641.  
  642.       4.2 MIO Function Summary
  643.  
  644.        mioDriver : Drives the execution of mioSendTo, mioWaitFor, or
  645.                    mioQuiet once they have been started.
  646.         mioBreak : Forces the MIO driver to IDLE state.
  647.        mioSendTo : Sends a string (including control chars) to the modem.
  648.       mioWaitFor : Waits  for a particular string from the modem, passing
  649.                    all else through.
  650.         mioQuiet : Waits for continuous quiet of a specified duration.
  651.         mioBreak : Breaks further modem I/O activity.
  652.  
  653.       Refer to the WSC Reference Manual for more information.
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.      WSC4D Users Manual                                        Page 11
  661.  
  662.       5.0 XMODEM & YMODEM
  663.  
  664.       5.1 XYDRIVER Introduction
  665.  
  666.       The XMODEM & YMODEM functions are implemented in XYDRIVER as a DLL
  667.       (Dynamic Link Library), and are state driven like the Modem I/O
  668.       functions described in the previous section. The TERM program
  669.       provides an example of using XYDRIVER.
  670.  
  671.       Files can be sent and received using XMODEM, XMODEM/CRC, XMODEM/1K,
  672.       and YMODEM. The basic procedure used to run XMODEM or YMODEM is as
  673.       follows:
  674.  
  675.       (1) Call xyAcquire immediately after calling SioReset.
  676.       (2) To receive a file, call xyStartRx, then call xyDriver
  677.           repeatedly until XY_IDLE is returned.
  678.       (3) To send a file, call xyStartTx, then call xyDriver repeatedly
  679.           until XY_IDLE is returned.
  680.       (4) Call xyRelease immediately before calling SioDone.
  681.  
  682.  
  683.  
  684.       5.2 XYDRIVER Function Summary
  685.  
  686.              xyAbort : Abort driver at any time.
  687.            xyAcquire : Acquire a port.
  688.              xyDebug : Set the debug level.
  689.             xyDriver : Executes the next state or states.
  690.         xyGetMessage : Get the next debug message.
  691.       xyGetParameter : Get a driver parameter.
  692.            xyRelease : Release a port.
  693.            xyStartRx : Start a receive.
  694.            xyStartTx : Start a transmit.
  695.  
  696.       Refer to the WSC Reference Manual for more information.
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.      WSC4D Users Manual                                        Page 12
  721.  
  722.       6.0 Problems
  723.  
  724.       If you cannot get your application to run properly, first compile and
  725.       run the terminal emulator program SIMPLE provided on your
  726.       distribution disk. Test SIMPLE by connecting two computers with a
  727.       null modem cable or by commanding a Hayes AT command set compatible
  728.       modem.
  729.  
  730.       Once EASY runs, compile and run the SELFTEST program.  This program
  731.       will test your serial ports' functionality.
  732.  
  733.       If your application does not run but EASY and SELFTEST run correctly,
  734.       then you have most likely made a programming mistake in your
  735.       application. MarshallSoft Computing cannot debug your application,
  736.       especially over the telephone!  However, consider each of the
  737.       following when searching for an error in your application.
  738.  
  739.       1.  Have you included the file WSC.PAS in your application ?
  740.  
  741.       2.  Are your receive and transmit buffers large enough ? Use a buffer
  742.       size that is twice the size of the largest expected block.
  743.  
  744.       3.  Have you selected too high a baud rate? Windows can multitask
  745.       many tasks at once. You may have to lower your baud rate (or get
  746.       16550 UARTS).
  747.  
  748.       4.  Did SioReset return a zero value ?  If not, then you must call
  749.       SioReset again. See EASY_PGM.PAS for an example.
  750.  
  751.       5.  Did you send the proper initialization string to your modem ?
  752.       Did you set DTR and RTS? (you should).
  753.  
  754.       7. Are you trying to link a 32-bit DLL to a 16-bit program (or vice
  755.       versa)? Keep Win16 (Delphi 1) & Win32 (Delphi 2) development
  756.       separate.
  757.  
  758.       We recommend the following steps if you believe that you have
  759.       discovered a bug in the library: (1) Create the smallest, simplest
  760.       test program possible that demonstrates the problem.  (2) Document
  761.       your exact machine configuration and what error the test program
  762.       demonstrates.  (3) Upload the example source to our user support BBS,
  763.       email it or mail us a disk.
  764.  
  765.       If the problem can be solved with an easy work-around, we will
  766.       publish the work-around.  If the problem requires a modification to
  767.       the library, we will make the change and make the modified library
  768.       available to our customers without charge.
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.      WSC4D Users Manual                                        Page 13
  781.  
  782.       7.0 Serial Communications
  783.  
  784.       7.1 Communications Basics
  785.  
  786.       The heart of serial communications is the UART (Universal
  787.       Asynchronous Receiver Transmitter).  The IBM PC/XT/AT and
  788.       compatibles use the 8250, 16450, or the 16550 UART.  The purpose of
  789.       the UART is:
  790.  
  791.       (1) To convert bytes from the CPU (Central Processing Unit), into a
  792.       serial format by adding the necessary start, stop, and parity bits to
  793.       each byte before transmission, and to then transmit each bit at the
  794.       correct baud rate.
  795.  
  796.       (2) To convert the incoming stream (at a specified baud rate) of
  797.       serial bits into bytes by removing the start, stop, and parity bits
  798.       before being made available to the CPU.
  799.  
  800.       The UART is part of the serial interface circuitry which allows the
  801.       CPU to send and receive signals over the RS232 lines. This can be
  802.       diagrammed as follows:
  803.  
  804.                             Serial Interface
  805.                          +-------------------+
  806.                          |                   |
  807.       +-----+  Data Bus  |     +------+      |    RS232 Signals
  808.       | CPU +------------+     | UART |      +----------------*
  809.       +-----+            |     +------+      |
  810.                          |                   |
  811.                          +-------------------+
  812.  
  813.       The 8250/16450/16550 UART is capable of operating in one of two
  814.       modes, 'polled' and 'interrupt driven'.  The serial communications
  815.       functions in the BIOS use the polled method.  In this approach, the
  816.       CPU is typically in a loop asking the UART over and over again if it
  817.       has a byte ready.  If its does, the polling code returns the byte.
  818.       But, if the next byte comes in before the polling code is executing
  819.       again, then that byte is lost.
  820.  
  821.       In the interrupt driven approach (used by Windows/WSC4D), when a byte
  822.       is received by the UART, an 'Interrupt Service Routine' (ISR) is
  823.       executed immediately, suspending temporarily whatever else is
  824.       executing. The ISR then moves the byte to a buffer so that your
  825.       application program can later read it.
  826.  
  827.       Transmitted bytes are queued up awaiting transmission.  When a byte
  828.       is moved from the UART transmitter holding register to the UART
  829.       transmitter shift register, an interrupt is generated and the next
  830.       byte is taken from the library transmitter buffer by the ISR and
  831.       written to the UART holding register.
  832.  
  833.       Up to 16 bytes can be taken from the transmitter buffer while
  834.       processing one transmitter interrupt if an 16550 UART is used. The
  835.       16550 UART is strongly recommended for computers doing serial
  836.       communications under Windows.
  837.  
  838.  
  839.  
  840.      WSC4D Users Manual                                        Page 14
  841.  
  842.       7.2 RS-232 Signals
  843.  
  844.       RS-232 is the name of the serial data interface standard used to
  845.       connect computers to modems.  Most IBM compatible computers are built
  846.       with at least one serial port and use either DB9 (9 pin) or DB25 (25
  847.       pin) connectors.
  848.  
  849.       A summary of these pins and their function follows.  For more
  850.       detailed information, refer to one of the many books dealing with
  851.       RS-232 interfacing.
  852.  
  853.       Signal Ground Pin 7 (DB25), Pin 5 (DB9)
  854.  
  855.       The SG line is used as the common signal ground, and must always be
  856.       connected.
  857.  
  858.       Transmit Data Pin 2 (DB25), Pin 3 (DB9)
  859.  
  860.       The TX line is used to carry data from the computer to the modem.
  861.  
  862.       Receive Data Pin 3 (DB25), Pin 2 (DB9)
  863.  
  864.       The RX line is used to carry data from the modem to the computer.
  865.  
  866.       Data Terminal Ready Pin 20 (DB25), Pin 4 (DB9)
  867.  
  868.       The DTR line is used by the computer to signal the modem that it is
  869.       ready. DTR should be set high when talking to a modem.
  870.  
  871.       Data Set Ready Pin 6 (DB25), Pin 6 (DB9)
  872.  
  873.       The DSR line is used by the modem to signal the computer that it is
  874.       ready.
  875.  
  876.       Request to Send Pin 4 (DB25), Pin 7 (DB9)
  877.  
  878.       The RTS line is used to 'turn the line around' in half duplex modems,
  879.       and for hardware flow control in most modems that require flow
  880.       control.  RTS is controlled by the computer and read by the serial
  881.       device (modem).
  882.  
  883.       Clear to Send Pin 5 (DB25), Pin 8 (DB9)
  884.  
  885.       The CTS line is used to 'turn the line around' in half duplex modems,
  886.       and for hardware flow control in most modems that require flow
  887.       control.  CTS is controlled by the serial device (modem) and read by
  888.       the computer.
  889.  
  890.       Data Carrier Detect Pin 8 (DB25), Pin 1 (DB9)
  891.  
  892.       The DCD line is used by the modem to signal the computer that a data
  893.       carrier signal is present.
  894.  
  895.       Ring Indicator Pin 22 (DB25), Pin 9 (DB9)
  896.  
  897.       The RI line is asserted when a 'ring' occurs.
  898.  
  899.  
  900.      WSC4D Users Manual                                        Page 15
  901.  
  902.       8.0 Example Programs
  903.  
  904.       8.1 EASY
  905.  
  906.       EASY (EASY_PRJ) is a very simple communications program using WSC4D.
  907.       Everything that is typed on the keyboard is sent to the serial port,
  908.       and everything incoming from the serial port is displayed on the
  909.       screen.
  910.  
  911.       The easiest way to test EASY is to connect to a modem.  Typing 'AT'
  912.       should result in an 'OK' being displayed.
  913.  
  914.       A null-modem cable can also be used to connect two computers together
  915.       with their serial ports. Run EASY on both machines. Whatever is typed
  916.       on one machine will be displayed on the other.
  917.  
  918.       8.2 SELFTEST
  919.  
  920.       SELFTEST (SELF_PRJ) performs a serial port I/O functionality test.
  921.       Either a pair of ports on the same computer (using a null modem
  922.       cable) or a single port (using a loopback adapter) can be tested.
  923.  
  924.       Refer to LOOPBACK.TXT for an explanation of how to make a loopback
  925.       adapter (without tools!).
  926.  
  927.       8.3 MODEM
  928.  
  929.       MODEM (MODM_PRJ) is similar to EASY, but with enhanced capability. It
  930.       can set flow control (hardware, software, or none), DTR line (set or
  931.       clear), RTS line (set or clear), display the transmit & receive queue
  932.       sizes, detect a break signal, detect changes in DSR and CTS, as well
  933.       as check for various line errors (parity error, framing error, data
  934.       overrun, receive queue overflow, and transmit buffer full).
  935.  
  936.       8.4 TERM
  937.  
  938.       TERM (TERM_PRJ) is a simple terminal emulator suitable for calling up
  939.       a BBS (such as ours) and downloading or uploading files using XMODEM
  940.       or YMODEM. The TERM program uses MIO.DLL for modem control commands,
  941.       and the XYDRIVER.DLL for XMODEM & YMODEM file transfer.
  942.  
  943.       Selecting 'Dial' from the menu bar will result in a pop-up dialog
  944.       requesting the phone number to dial. Once entered, the number is
  945.       dialed, and the program will wait for up to 60 seconds for the
  946.       'CONNECT' string from the modem.  This wait can be terminated at any
  947.       time by choosing 'BREAK' on the menu bar.
  948.  
  949.       Once logged on, files can be uploaded or downloaded by selecting
  950.       'Send' or 'Receive' from the menu bar. To abort a file transfer,
  951.       choose 'BREAK' from the menu bar then type a series of Ctrl-X (^X)
  952.       characters from the keyboard.
  953.  
  954.       8.5 FIND
  955.  
  956.       FIND (FIND_PRJ) searches your computer for attached modems. Just
  957.       start FIND and select "FindModem" on the menu bar.
  958.  
  959.  
  960.      WSC4D Users Manual                                        Page 16
  961.  
  962.       9.0 Legal Issues
  963.  
  964.       9.1 Registration
  965.  
  966.       WSC4D may be registered for $75 plus $5 S&H ($10 outside of North
  967.       America).
  968.  
  969.       To order, contact us as shown on the title page of this manual. All
  970.       prices are guaranteed for one year from the release date.
  971.  
  972.       Multiple copy discounts (3 or more) and site licenses are available.
  973.       Please call for details.
  974.  
  975.       We accept American Express, VISA, MasterCard, Discover, US dollars
  976.       drawn on a US bank, International Postal Money Orders, purchase
  977.       orders (POs) from recognized US schools and companies listed in Dun &
  978.       Bradstreet, and COD (street address and phone number required) within
  979.       the USA (plus a $4.50 COD charge).
  980.  
  981.       For credit card orders, be sure to include the account number, the
  982.       expiration date, the exact name on the card, and the complete card
  983.       billing address (the address to which the credit card bill is
  984.       mailed).
  985.  
  986.       Print the file INVOICE.TXT if a 'Pro Forma' invoice is needed.
  987.  
  988.       If you wish to update from an older version of WSC4D, send $25 plus
  989.       $5 S&H ($10 S&H outside of North America).
  990.  
  991.       The registered package includes:
  992.  
  993.            o  Win16 & Win32 WSC4D Libraries w/o shareware screens.
  994.            o  Win16 & Win32 source code for WSC, MIO, and XYDRIVER.
  995.            o  Printed Users Manual & Reference Manual.
  996.            o  Telephone, BBS, and email support for one year.
  997.  
  998.       The registered user will receive the latest version of WSC4D shipped
  999.       by US second day priority mail (packet airmail overseas).  A 3.5' HD
  1000.       diskette is provided.
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.      WSC4D Users Manual                                        Page 17
  1021.  
  1022.       9.2 License
  1023.  
  1024.       MarshallSoft Computing, Inc. grants the registered user of WSC4D the
  1025.       right to use one copy of the WSC4D library (in object form) on a
  1026.       single computer in the development of any software product (other
  1027.       more than one computer at the same time.  The source code for the
  1028.       library (WSC16.C, WSC32.C, MIO.C, and XYDRIVER.C) is copyrighted by
  1029.       MarshallSoft Computing and may not be released in whole or in part.
  1030.       Products developed using WSC4D may be distributed without royalty.
  1031.  
  1032.       9.3 Warranty
  1033.  
  1034.       MARSHALLSOFT COMPUTING, INC.  DISCLAIMS ALL WARRANTIES RELATING TO
  1035.       THIS SOFTWARE, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  1036.       LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  1037.       A PARTICULAR PURPOSE, AND ALL SUCH WARRANTIES ARE EXPRESSLY AND
  1038.       SPECIFICALLY DISCLAIMED. NEITHER MARSHALLSOFT COMPUTING, INC. NOR
  1039.       ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION, OR
  1040.       DELIVERY OF THIS SOFTWARE SHALL BE LIABLE FOR ANY INDIRECT,
  1041.       CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT OF THE USE OR
  1042.       INABILITY TO USE SUCH SOFTWARE EVEN IF MARSHALLSOFT COMPUTING, INC.
  1043.       HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIMS. IN NO
  1044.       EVENT SHALL MARSHALLSOFT COMPUTING, INC.'S LIABILITY FOR ANY SUCH
  1045.       DAMAGES EVER EXCEED THE PRICE PAID FOR THE LICENSE TO USE THE
  1046.       SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE PERSON USING THE
  1047.       SOFTWARE BEARS ALL RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  1048.       SOFTWARE.
  1049.  
  1050.       Some states do not allow the exclusion of the limit of liability for
  1051.       consequential or incidental damages, so the above limitation may not
  1052.       apply to you.
  1053.  
  1054.       This agreement shall be governed by the laws of the State of Alabama
  1055.       and shall inure to the benefit of MarshallSoft Computing, Inc. and
  1056.       any successors, administrators, heirs and assigns.  Any action or
  1057.       proceeding brought by either party against the other arising out of
  1058.       or related to this agreement shall be brought only in a STATE or
  1059.       FEDERAL COURT of competent jurisdiction located in Madison County,
  1060.       Alabama. The parties hereby consent to in personam jurisdiction of
  1061.       said courts.
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.      WSC4D Users Manual                                        Page 18
  1081.  
  1082.       10.0 Summary
  1083.  
  1084.       10.1 Revision History
  1085.  
  1086.       Version 2.0: 17 February, 1997.
  1087.  
  1088.           o  Includes Win16 (Delphi 1) and Win32 (Delphi 2) libraries.
  1089.           o  Added XMODEM & YMODEM DLL (XYDRIVER.DLL).
  1090.           o  Added TERM example program.
  1091.  
  1092.       Version 2.1: 9 June, 1997.
  1093.  
  1094.           o  Screen display uses MEMO class.
  1095.           o  WIN32 version can display error text from Win32 Windows.
  1096.           o  Added FIND example program.
  1097.           o  Added SioRead function.
  1098.           o  SioInfo can return seconds to expiration [SHAREWARE].
  1099.  
  1100.       10.2 WSC Function Summary
  1101.  
  1102.       Refer to the WSC4D Reference Manual (WSC4D_R.TXT) for detailed
  1103.       information on the communications and support functions.  A one line
  1104.       summary of each function follows:
  1105.  
  1106.       +-------------+-----------------------------------------------------+
  1107.       |  SioBaud    |  Sets the baud rate of the selected port.           |
  1108.       |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.         |
  1109.       |  SioCTS     |  Reads the Clear to Send (CTS) modem status bit.    |
  1110.       |  SioDCD     |  Reads the Data Carrier Detect (DCD) modem status.  |
  1111.       |  SioDone    |  Terminates further serial processing.              |
  1112.       |  SioDSR     |  Reads the Data Set Ready (DSR) modem status bit.   |
  1113.       |  SioDTR     |  Set, clear, or read the Data Terminal Ready (DTR). |
  1114.       |  SioFlow    |  Enables / disables hardware flow control.          |
  1115.       |  SioGetc    |  Reads the next character from the serial line.     |
  1116.       |  SioGets    |  Reads a string of characters.                      |
  1117.       |  SioInfo    |  Returns information such as library version.       |
  1118.       |  SioParms   |  Sets parity, stop bits, and word length.           |
  1119.       |  SioPutc    |  Transmit a character over a serial line.           |
  1120.       |  SioPuts    |  Transmits a string of characters.                  |
  1121.       |  SioRead    |  Reads any UART register directly from hardware.    |
  1122.       |  SioReset   |  Initialize a serial port for processing.           |
  1123.       |  SioRI      |  Reads the Ring Indicator (RI) modem status bit.    |
  1124.       |  SioRTS     |  Sets, clears, or reads the Request to Send (RTS).  |
  1125.       |  SioRxClear |  Clears the receive buffer.                         |
  1126.       |  SioRxQue   |  Returns the number of characters in the RX queue.  |
  1127.       |  SioStatus  |  Returns the serial port line status.               |
  1128.       |  SioTxClear |  Clears the transmit buffer.                        |
  1129.       |  SioTxQue   |  Returns the number of characters in the TX queue.  |
  1130.       |  SioUnGetc  |  'Ungets' (puts back) a specified character.        |
  1131.       +-------------+-----------------------------------------------------+
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.      WSC4D Users Manual                                        Page 19
  1141.  
  1142.       10.3 Further Reading
  1143.  
  1144.  
  1145.       The best way to learn about serial communications is to read a good
  1146.       book on the subject. Several good texts are available.  Two that I
  1147.       like are:
  1148.  
  1149.       (1) C Programmer's Guide to Serial Communications by Joe Campbell
  1150.       (SAMS) (2) Mastering Serial Communications by Peter Gofton (SYBEX).
  1151.  
  1152.       You may also want to get a copy of one of our communications products
  1153.       which talks to the hardware directly.  They include more hardware
  1154.       specific documentation.
  1155.  
  1156.       11.0 Other MarshallSoft Computing Products
  1157.  
  1158.       Several shareware products are available from MarshallSoft Computing.
  1159.  
  1160.       11.1 The Personal Communications Library for Windows (C/C++)
  1161.  
  1162.       The Personal Communications Library for Windows (PCL4W) is a Windows
  1163.       based [Win16] asynchronous communications library designed for
  1164.       software developers programming in C/C++.  Unlike WSC4D, PCL4W
  1165.       interfaces to the serial port hardware directly.  PCL4W also supports
  1166.       multiport boards such as those made by DigiBoard and BOCA.
  1167.  
  1168.       The Personal Communications Library for Windows (PCL4W) is available
  1169.       for $75 plus $5 S&H ($10 S&H overseas).
  1170.  
  1171.       11.2 The Personal Communications Library for Pascal / DOS
  1172.  
  1173.       PCL4P is similar to PCL4W except that it is designed for DOS.
  1174.       Includes support for both 16-bit protected mode.
  1175.  
  1176.       11.3 Libraries for Other Languages
  1177.  
  1178.       We have communications libraries for C/C++, Turbo Pascal, Visual
  1179.       Basic, and PowerBASIC.
  1180.  
  1181.        PCL4C  : C/C++, DOS [include 16-bit & 32-bit protected mode].
  1182.        PCL4P  : Turbo Pascal, DOS [includes 16-bit protected mode].
  1183.        PCL4VB : Visual Basic, DOS.
  1184.        PCL4PB : Power Basic, DOS.
  1185.  
  1186.         PCL4W : C/C++, Windows 3.1 & Win 95, talks to hardware directly.
  1187.        PCLVBW : Visual Basic, Win 3.1 & Win 95, talks to hardware directly.
  1188.  
  1189.         WSC4C : C/C++, Win 3.1, Win 95, Win NT. Uses Windows API.
  1190.        WSC4VB : Visual Basic, Win 3.1, Win 95, Win NT. Uses Windows API.
  1191.         WSC4D : Borland Delphi, Win 3.1, Win 95, Win NT. Uses Windows API.
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.      WSC4D Users Manual                                        Page 20
  1201.  
  1202.